﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ArrayStatus
{
    internal class Program
    {
        static void Main(string[] args)
        {
            List<int> tmp = new List<int>();
            string c = "";
            Console.WriteLine("Enter Array's elements, end with \";\"");
            while (c != ";")
            {
                c=Console.ReadLine();
                try
                {
                    if (c == ";")
                    {
                        break;
                    }
                    tmp.Add(int.Parse(c));
                }
                catch (Exception)
                {

                    Console.WriteLine("Invalid Input! Cannot put this into an integer array!");
                }
                
            }
            int[] a = tmp.ToArray<int>();
            int max = 0;
            int min = 0;
            int sum = 0;
            int avg = 0;
            if (a.Count<int>() != 0) {
                max = a[0];
                min = a[0];
                sum = 0;
                avg = 0;
                
            }
            foreach (int j in a)
            {
                if (j < min) { min = j; }
                if (j > max) { max = j; }
                sum += j;
            }
            avg = sum / a.Count<int>();
            Console.Write("\n\n\n\n");
            Console.WriteLine("The status of this Array<int>:");
            Console.WriteLine("Max:" + max);
            Console.WriteLine("Min:" + min);
            Console.WriteLine("Sum:" + sum);
            Console.WriteLine("Avg:" + avg);
            Console.ReadKey();
        }

    }
}
